package com.devicestatus.entity;

import com.devicestatus.tools.Uniqid;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;
import java.util.Date;

/**
 * @author MeowParse
 * @date 2017/8/15.
 */
@Entity
@Table(name = "device_online_record")
public class DeviceOnlineRecord {

	@Id
	@Column(name = "id")
	private String id;
	@Column(name = "device_id")
	private String deviceId;
	@Column(name = "created")
	private Date created;
	@Column(name = "online")
	private Integer online;

	public DeviceOnlineRecord(){
	}

	public DeviceOnlineRecord(String deviceId,int online) {
		this.created = new Date();
		this.id = Uniqid.MD5(created.toString()+deviceId);
		this.deviceId = deviceId;
		this.online = online;
	}

	public String getId() {
		return id;
	}

	public void setId(String id) {
		this.id = id;
	}

	public String getDeviceId() {
		return deviceId;
	}

	public void setDeviceId(String deviceId) {
		this.deviceId = deviceId;
	}

	public Date getCreated() {
		return created;
	}

	public void setCreated(Date created) {
		this.created = created;
	}

	public Integer getOnline() {
		return online;
	}

	public void setOnline(Integer online) {
		this.online = online;
	}

}
